const getDefaultState = () => {
  return {
    temp: {},
    location: {}
  }
}

const state = getDefaultState()

const mutations = {
  RESET_STATE: (state) => {
    Object.assign(state, getDefaultState())
  },
  SET_TEMP: (state, temp) => {
    state.temp = temp
  },
  SET_LOCATION: (state, location) => {
    state.location = location
  }
}

const actions = {
  setLocation({ commit }, location) {
    commit('SET_LOCATION', location)
  },
  setTemp({ commit }, temp) {
    commit('SET_TEMP', temp)
  }
}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}
